/**
 * 
 */


var globleConstant = new Object();
globleConstant.pageSize=30;

function mls_openMenu(url,name){
    var win = window.open(url,name);
    win.focus();
}

function mls_showOpMenu(e){
    $('#mls_op_menu_div').menu('show', {
        left: e.pageX,
        top: e.pageY
    });
}


function mls_addMenuDiv(divArray){
	$("#mls_op_menu_div").html('');
	for(var i=0;i<divArray.length; i++){
		$("#mls_op_menu_div").append(''+divArray[i]);
	}
}

//=====start validate=========
function mls_validate_latAndLon(lalo){
	if(lalo==""){
		$.messager.alert("提示","经纬度不能为空(格式：经度，纬度).");
		return false;
	}
	return true;

}

function get_text_length(data){
	var totalLength = 0;     
    var charCode;  
    for (var i = 0; i < data.length; i++) {  
        charCode = this.charCodeAt(i);  
        if (charCode < 0x007f)  {     
            totalLength++;     
        } else if ((0x0080 <= charCode) && (charCode <= 0x07ff))  {     
            totalLength += 2;     
        } else if ((0x0800 <= charCode) && (charCode <= 0xffff))  {     
            totalLength += 3;   
        } else{  
            totalLength += 4;   
        }          
    }  
    return totalLength;  
}

//判断正整数  
function checkIntRate(data)  
{  
     var re = /^[1-9]+[0-9]*$/;
     if (!re.test(data))  
    {  
        return false;  
     }  
    return true;
} 
//判断为整数
function checkRate(data)  
{  
     var re = /^[0-9]+$/;
     if (!re.test(data))  
    {  
        return false;  
     }  
    return true;
} 
//保留小数点后一位
function checkOnePointRate(data){
	var re = /^[0-9]+\.[0-9]{1}$/;
	 if (!re.test(data))  
	    {  
	        return false;  
	     }  
	    return true;
}
//计算两个日志间的天数差传入日期格式 为:2015-01-01
function getDaysBetweenTwoDate(startDate,endDate){
	var start = new Date(startDate.replace(/-/g,"/"));
	var end = new Date(endDate.replace(/-/g,"/"));
	var diff = parseInt((end - start) / (1000*60*60*24)); 
	return diff;
}


function removeLastComma(arg){
    var str = arg;
    if(str==null){
        return null;
    }

    while(str[str.length-1]==',' || str[str.length-1]=='，'){
        str = str.substring(0,str.length-2);
    }
    return str;
}